package com.shop2cn.iapi.liveordermanage.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

public class UserClickCall extends YmatouBaseCall{

	private static String opurl ="api/sqlive/userClick";
	
	public UserClickCall() {
		super(EnvSetup.getSystemUrl("liveordermanage"),opurl,"POST","JSON");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取code
	 * 
	 * @return
	 */
	public int getCode() {
		int code = 0;
		try {
			code = new JSONObject(getReturnData()).getInt("errorCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return code;
	}

	/**
	 * 获取msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String msg = "";
		try {
			msg = new JSONObject(getReturnData()).getString("errorMessage");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return msg;
	}
}
